home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
shrlk201.zip
/
_SETUP.1
/
nsDateEdit.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1997-07-22
|
2KB
|
76 lines
unit nsDateEdit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, DsgnIntf, nsShareLock,
StdCtrls, Grids, Calendar, ExtCtrls, ComCtrls;
type
TfrmDate = class(TForm)
btnOk: TButton;
cmbMonth: TComboBox;
btnCancel: TButton;
cal: TCalendar;
txtYear: TEdit;
udYear: TUpDown;
procedure cmbMonthChange(Sender: TObject);
procedure calChange(Sender: TObject);
procedure calDblClick(Sender: TObject);
procedure udYearChanging(Sender: TObject; var AllowChange: Boolean);
procedure udYearClick(Sender: TObject; Button: TUDBtnType);
private
{ Private declarations }
public
function Execute(Year, Month, Day: Word): string;
end;
//var Form1: TForm1;
implementation
{$R *.DFM}
function TfrmDate.Execute(Year, Month, Day: Word): string;
begin
//Parse date and change cal.
Cal.Day := Day;
udYear.Position := Year;
Cal.Year := Year;
txtYear.Text := IntToStr(Year);
cmbMonth.ItemIndex := Month - 1;
Cal.Month := cmbMonth.ItemIndex + 1;
if Showmodal = mrOk then Result := FormatDateTime('ddddd', Cal.CalendarDate)
else Result := '';
end;
procedure TfrmDate.cmbMonthChange(Sender: TObject);
begin
Cal.Day := 1;
Cal.Month := cmbMonth.ItemIndex + 1;
end;
procedure TfrmDate.calChange(Sender: TObject);
begin
Caption := FormatDateTime('dddddd', Cal.CalendarDate);
end;
procedure TfrmDate.calDblClick(Sender: TObject);
begin
btnOk.Click;
end;
procedure TfrmDate.udYearChanging(Sender: TObject;
var AllowChange: Boolean);
begin
Cal.Year := udYear.Position;
end;
procedure TfrmDate.udYearClick(Sender: TObject; Button: TUDBtnType);
begin
Cal.Year := udYear.Position;
end;
end.